<?php
namespace Home\Controller;
use Think\Controller;
class UserController extends Controller {
    //注册模板
    public function register(){
       $this->display();
        
    }

    //手机注册模板
    public function phone(){
        $this->display();
    }
    
    
	//登录模板
    public function login(){

        $this->display();
    }

    //处理注册方法
    public function reg_success(){
        $data = array();
        $data['user_name'] = $_POST['user_name'];
        $data['user_pass'] = $_POST['user_pass'];

        //保存注册信息入库
        if($res = M('user')->add($data)){
            $this->ajaxReturn(array('success'=>1,'msg'=>'注册成功'));
        }else{
            $this->ajaxReturn(array('error'=>0,'msg'=>'注册失败'));
        }
    }


    //处理登录方法
    public function login_success(){
        $data = $_POST;
        $arr = array(
            'user_name'=>$data['user_name'],
            'user_pass'=>md5($data['user_pass']),
        );
       
        //验证用户信息
        $user = M('user')->where($arr)->find();


        if(empty($user)){
            $this->ajaxReturn(array('error'=>0,'msg'=>'登录失败'));
           
        }else{
            //存储session
            // session('user_id',$user['id']);
            // session('username',$user['user_name']);
            $this->ajaxReturn(array('success'=>1,'msg'=>'登录成功'));
            
        }

    }


    //个人中心
    public function per_index(){
        $this->display();
    }

    //收藏夹
    public function per_collection(){
        $this->display();
    }


    //购物车
    public function shopcart(){
        $this->display();
    }

    //个人资料
    public function per_information(){
        $this->display();
    }
    

    //安全设置
    public function per_safety(){
        $this->display();
    }

    //收货地址
    public function per_address(){
        $this->display();
    }

    //订单管理
    public function per_order(){
        $this->display();
    }

    //售货退换
    public function per_change(){
        $this->display();
    }

    //评价
    public function per_comment(){
        $this->display();
    }

    //足迹
    public function per_foot(){
        $this->display();
    }

    //消息
    public function per_news(){
        $this->display();
    }

    //邮箱绑定
    public function per_email(){
        $this->display();
    }

    //登录密码
    public function per_password(){
        $this->display();
    }

    //支付密码
    public function per_setpay(){
        $this->display();
    }

    //安全问题
    public function per_question(){
        $this->display();
    }

    //新闻页面
    public function per_blog(){
        $this->display();
    }

    //钱款去向
    public function per_record(){
        $this->display();
    }

    //物流
    public function per_logistics(){
        $this->display();
    }

    //账单明细
    public function per_billlist(){
        $this->display();
    }
   
}